<? require_once("header.php"); ?>

    <script>
        function confirmCommit(form) {
            if( form.cmsg.value == '' ) {
                alert('커밋 메세지가 비어있습니다');
                return;
            }

            if( !confirm('정말 커밋하길 원합니까?') ) {
                return;
            }

            form.submit();
        }
    </script>
    <div id="svnStatusDiv" style="padding:5px;">
        <div id="svnStatusDivFilter" style="padding:0px;font-size:13px;">
            <a href="#" onClick="goStatusFilter('');">[ all ]</a>
            <a href="#" onClick="goStatusFilter('modified');">[modified]</a>
            <a href="#" onClick="goStatusFilter('unversioned');">[unversioned]</a>
            <a href="#" onClick="goStatusFilter('missing');">[missing]</a>
            <a href="#" onClick="goStatusFilter('normal');">[normal]</a>
        </div>
        <form id=svnCommitForm name=svnCommitForm method=POST action=LocalRepo2Svn.php>
            <input type="hidden" name=serviceid value="<?=$serviceId?>" />
            <input type="hidden" name=repoid value="<?=$repoId?>" />
            <input type="hidden" name=path value="<?=$path?>" />
            <input type="hidden" name=cmd value="commit" />
            <div name="commitMsgForm" id="commitMsgForm" style="display:none">
                <textarea cols=100 rows=5 name=cmsg></textarea><br />
                <a href="#" onclick="confirmCommit(document.svnCommitForm);">Commit하기</a> <br />
                * 커밋가능한 데이터를 모두 커밋하길 원하면 여기<input type=checkbox name=justcommit value=true onclick="chk.unchecked('all');"/>을 선택하세요. <br />
                * 그러면, status가 modified, deleted인 것들이 커밋되고, unversioned는 커밋되지 않습니다.<br />
                * 아니면, 커밋하고 싶은 것만 선택하세요. 선택한 unversioned는 자동으로 추가되고 커밋됩니다.
            </div>
        <table style="border:1px solid #A3B1BF;width:100%;font-family:verdana;font-size:13px">
            <tbody style="background-color:#CEE0F2">
                <th width="30"><a href="#" onclick="toggleSelection()">all</a></th>
                <th width="100">status</th>
                <th width="100">repo-status</th>
                <th width="50">revision</th>
                <th width="*" >path</th>
            </tbody>
<?
    if( sizeof( $svnstatus->entries ) > 0 ) {
        $count = 0;
        $checkbox_ids="";
        foreach( $svnstatus->entries as $statusEntry ) {
            $status   = $statusEntry->wcStatus;
            $revision = $statusEntry->wcStatusRev;
            $repoStatus    = $statusEntry->repoStatus;
            $sePath     = $statusEntry->path;

            $ext = strrchr($sePath, ".");
            $l = @$extEnscript[$ext];
            if( (!empty( $filter )&&($filter == $status)) || empty( $filter ) ) {
?>
            <tr>
                <td width="30">
<?
                if( $status == "modified" || $status == "deleted" || $status == "unversioned" ) {
                    $checkbox_id = "c".(++$count);
                    $checkbox_ids = $checkbox_ids.(($count>1) ? ",\"".$checkbox_id."\"" : "\"".$checkbox_id."\"");
?>
                    <input type="checkbox" name="check[]" id="<?=$checkbox_id?>" value="<?=$status.":".$sePath?>"/>

<?  } ?>
                </td>
                <td width="100"><?=$status?></td>
                <td width="50"><?=$repoStatus?></td>
                <td width="50"><?=$revision?></td>
                <td width="*" class="left">
                <? if( $status != "none" && $status != "unversioned" ) { ?>
                    <a href="javascript:goDiffFileBrowser('cat','<?=$sePath?>');">[view]</a>
                <? } ?>
                <? if( $status == "modified" ) { ?>
                    <a href="javascript:goDiffFileBrowser('diff','<?=$sePath?>');">[diff]</a>
                <? } ?>
                <?=$sePath?></td>
            </tr>
<?
            }
        }
    }
?>
        </form>
        </table>

        <script type="text/javascript">
            var chk = new UI.CheckBox(<?=$checkbox_ids?>);
        </script>
    </div>

<? require_once("footer.php"); ?>

